package com.lagou.rocketmq.task.constant;


public class RedisKey {

  private static String PRODUCT_INVENTORY = "scekilling:product:inventory";

  private static final String SECKILLING_LOCK = "seckilling:lock";

  /**
   * 获取库存key
   *
   * @param productId
   * @return
   */
  public static String getProductInventoryKey(Integer productId) {
    return String.format("%s:%s", PRODUCT_INVENTORY, productId);
  }

  /**
   * 获取分布式锁
   *
   * @return
   */
  public static String getSeckillingLock(Integer customerId, Integer productId) {
    return String.format("%s:%s:%s",SECKILLING_LOCK, customerId, productId);
  }
}
